<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let str = 'sdsa22d3s1a12dsa'


    // 1. 替换字符串
    let res = str.replace(/\d/g, '')

    console.log(res);

    // 2. 查找匹配到的第一个的索引
    let search = str.search(/\d/g)
    console.log(search);

    // 3. 显示匹配到的内容
    let match = str.match(/\d/g)
    console.log(match);

    // 4. 检测是否匹配
    let res1 = /^\d/.test(str) // 字符串是否以数字开头
    console.log(res1);
  </script>
</body>

</html>